function btnEdit(id) {
    console.log('跳转编辑页面');
    location.href = '/blogs/' + id

}
function btnDel(id) {
    console.log('准备删除');

}
function btnAdd() {
    console.log('新增');

    location.href = '/blogs/' + 0
}



const table = document.querySelector("#myTable > tbody");
const rows = table.querySelectorAll("tr");
const rowsPerPage = 10; // 每页显示的行数
let currentPage = 1;

function showPage(page) {
    let start = (page - 1) * rowsPerPage;
    let end = start + rowsPerPage;

    for (let i = 0; i < rows.length; i++) {
        rows[i].style.display = (i >= start && i < end) ? "" : "none";
    }

    // 更新分页信息
    document.getElementById("pageInfo").innerText = `第 ${page} 页 / 共 ${Math.ceil(rows.length / rowsPerPage)} 页`;
}

function nextPage() {
    if (currentPage < Math.ceil(rows.length / rowsPerPage)) {
        currentPage++;
        showPage(currentPage);
    }
}

function prevPage() {
    if (currentPage > 1) {
        currentPage--;
        showPage(currentPage);
    }
}

// 初始化显示第一页
showPage(currentPage);